<template>
	<view class="page flex-col">
		<cu-custom bgColor="bg-gradual-red" :isBack="true">
			<block slot="content">我的拍卖会</block>
		</cu-custom>
		<empty v-if="auctionlistData.length == 0"></empty>
		<view class="section1 flex-col">
			<view class="Body flex-col">
				<view class="bd2 flex-col justify-between">
					<view class="box3 flex-col">
						<view class="group1 flex-col" v-for="(item, index1) in auctionlistData" :key="index1" @click="godetail(item)">
							<view class="outer1 flex-row justify-between">
								<view class="box4 flex-col">
									<image class="box5" :src="$getFileAccessHttpUrl(item.icon)"
										mode="aspectFill"></image>
								</view>
								<view class="flex-col  justify-between">
									<view class="TextGroup1 flex-col">
										<view class="txt2">
											{{tabIndex == 0 ? item.title : item.itemName}}
										</view>
										<view class="wordbox" v-if="tabIndex == 1">
											<view class="word3">报名费：</view>
											<view class="word1">{{item.applyCost}}
											</view>
											<view class="word3 margin-left">保证金：
											</view>
											<view class="word1">
												{{item.earnestMoney}}</view>
										</view>
										<view class="wordbox" v-if="tabIndex == 0">
											<view class="word3 labelbordr">
												{{item.category}}</view>
										</view>
										<view class="wordbox" v-if="tabIndex == 0">
											<view class="word3">
												拍品数量：{{item.itemNum == null ? '0' : item.itemNum}},
											</view>
											<view class="word2">
												下单数量：{{item.orderNum == null ? '0' : item.orderNum}}
											</view>
										</view>
										<view class="wordbox" v-if="tabIndex == 1">
											<view class="word3"
												v-if="item.itemStatus == 2">当前价
											</view>
											<view class="word3"
												v-if="item.itemStatus == 3">成交价
											</view>
											<view class="word1"
												v-if="item.itemStatus == 2">
												{{item.currentPrice}}
											</view>
											<view class="word1"
												v-if="item.itemStatus == 3">
												{{item.closingPrice}}
											</view>
											<view class="word2"
												v-if="item.itemStatus == 2 || item.itemStatus == 3 || item.itemStatus == 4 ">
												{{item.biddingNum}}次出价</view>
										</view>
										<view class="wordbox"
											v-if="item.status == 2">
											<view class="word3">
												报名截止时间：{{item.applyTime}}</view>
										</view>
										<view class="timeout">
											<view class="outer2 flex-col">
												<view class="word5">
													{{item.statusText}}
												</view>
											</view>
											<!-- <view class="word4">{{liveCountdown}}</view> -->
											<view class="word4"
												v-if="item.status == 2">
												{{item.startTime}}</view>
														
										</view>
														
									</view>
								</view>
							</view>
							<view v-if="tabIndex == 1 && item.hasApply"
								class="righbom active">
								<view class="circle">已报名</view>
							</view>
							<view class="wordbox positop"
								:style="item.auctionWay == 2 ? 'background: url(../../static/home/128/Bgblue.png) -4px 0px no-repeat;background-size: 57px 19px;':'background: url(../../static/home/128/Bgorange.png) -4px 0px no-repeat;background-size: 57px 19px;'">
								<view class="word3">
									{{tabIndex == 0 ? item.auctionWayText : item.itemStatusText}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="loadingType">{{loadingType == true ?'没有更多数据了!' : '上拉显示更多'}}</view>
		</view>

	</view>

</template>

<script>
	import server from '@/api/server.js'
	export default {
		props: {
		},
		data() {
			return {
				loadingType: false,
				auctionlistData:[],
				params: {
					pageNo: 1,
					pageSize: 10,
				},
				tabIndex: 0, // 选中的
			};
		},
		onLoad: function() {

		},
		
		//在.js文件中监听下拉触底
		onReachBottom:function(){
			if(!this.loadingType){
				this.apiauctionlist() //个人中心-我的报名（拍卖会）
			}
		}, 
		mounted() {
			this.apiauctionlist() //个人中心-我的报名（拍卖会）
		},
		
		computed: {
			
		},
		methods: {
			apiauctionlist(){
				server.auctionlist(this.params).then(res => {
				    	console.log(res)
				    	if (res.data.success) {
				    		if (res.data.result.records.length != 10) { //没有数据
				    			this.loadingType = true;
				    		}
				    		this.params.pageNo++; //每触底一次 page +1
				    		this.auctionlistData = this.auctionlistData.concat(res.data.result.records); //将数据拼接在一起
				    	}
				    })
			},
			godetail(item) {
				console.log('item',item)
				uni.navigateTo({
					url: '/page_myauction/myauction/myauctionDetail?auctionId=' + item.auctionId
				})
			
			},
			tabtap(index) {
				this.tabIndex = index;
			},
		},

		beforeDestroy() {

		},
	}
</script>

<style scoped lang="scss">

</style>
